<template>
    <el-tabs type="border-card" width="500px" class="demo-tabs">
        <el-tab-pane label="体检报告">
            <el-card class="box-card">
                <el-table :data="reportData" style="width: 100%" height="485">
                    <el-table-column label="序号" prop="id" width="55%" />
                    <el-table-column label="体检日期" prop="time" width="165%" />
                    <el-table-column label="体检医生" prop="dId" width="100%">
                        <template #default="scope">
                            {{ scope.row.doctor.name }}
                        </template>
                    </el-table-column>
                    <el-table-column label="姓名" prop="uId">
                        <template #default="scope">
                            {{ scope.row.user.name }}
                        </template>
                    </el-table-column>
                    <el-table-column label="操作" fixed="right" width="70%">
                        <template #default="scope">
                            <el-button size="small" text type="primary"
                                @click="toDetail(scope.$index, scope.row)">查看</el-button>
                            <!-- <el-button size="small" text type="primary"
                                        @click="toEdit(scope.$index, scope.row)">编辑</el-button> -->
                        </template>
                    </el-table-column>
                </el-table>
            </el-card>
        </el-tab-pane>

    </el-tabs>
</template>

<script setup>
import { storeToRefs } from "pinia";
import { useReportStore } from "../../../stores/report.js";
const reportStore = useReportStore()
const { reportData } = storeToRefs(reportStore)
const id = JSON.parse(sessionStorage.getItem('user')).id
reportStore.selectReport(id)

const toDetail = (index, row) => {
    reportStore.pre4Detail(index, row)
}
</script>

<style scoped>
.demo-tabs {
    height: 85vh;
}

.box-card {
    height: 100%;
}
</style>